﻿using AbpProjectTemplate.Domain.Users.Admins;
using AutoMapper;

namespace AbpProjectTemplate.Application.Users.Dtos
{
    public class AdminMapProfile : Profile
    {
        public AdminMapProfile()
        {
            //CreateMap<UserDto, User>();
            this.CreateMap<AdminDto, Admin>()
                .ForMember(x => x.Roles, opt => opt.Ignore())
                .ForMember(x => x.CreationTime, opt => opt.Ignore());

            this.CreateMap<AdminCreateInput, Admin>()
                .ForMember(t => t.Surname, t => t.MapFrom(x => x.Name))
                .ForMember(t => t.EmailAddress, t => t.MapFrom(x => $"{x.Name}@app.com"))
                .ForMember(x => x.Roles, opt => opt.Ignore());
        }
    }
}


